www.gusucode.com > XerCMS 携云PHP企业建站程序 v2015PHP源码程序 > XerCMS 携云PHP企业建站程序 v2015/XerCMS_v20150724/XerCMS_v20150724/XerCMS/Services/apis/index.php

    <?php
/**
 * @name     XERCMS
 * @author   Arno <XerCMS@163.com> [QQ:1328013]
 * @version  1.0.0
 * @link     http://www.XerCMS.com 
 */

!defined('XERCMS') && exit('Access Denied');

class Service_apis_index
{
     function data() {
          $number = 15;$page = 1;$id = (int)g('id');
          $data_select = DB::result('SELECT * FROM xercms_select_data WHERE id = \''.$id.'\'');
          if($data_select['state'] == 1 || empty($data_select['outer'])) {
               exit;
          }
          $data = DB::fetch_all($data_select['sql']);
          if(!empty($data)) {
               if($data_select['format'] == 1) {
                    exit(json_encode($data));
               } else {
                    $cacheFile = INC.'Caches/apis/apis_index_data_'.$id.'.php';
                    if(!file_exists($cacheFile)) {
                         X::$compiler = new compiler();
                         X::$compiler->sparse($data_select['template']);
                         X::$compiler->cacheId = 'apis_index_data_'.$id;
                         $cacheFile = X::$compiler->file('apis');                      
                    }
                    include($cacheFile);
               }
          }
	}
}
?>